/*
 * Copyright (c) 2023, 2023,yzc.cn All rights reserved.
 *
 */
package cn.yzc.service.Impl;

import cn.yzc.mapper.LeaveMapper;
import cn.yzc.pojo.Leave;
import cn.yzc.service.LeaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.List;

/**
 * <p>Project: SpringPro - LeaveServiceImpl</p>
 * <p>Powered by yzc On 2023-10-24 16:35:44</p>
 * <p>描述：<p>
 *
 * @author yzc [yzc0415@126.com]
 * @version 1.0
 * @since 17
 */

@Service
public class LeaveServiceImpl implements LeaveService {

    @Autowired
    LeaveMapper leaveMapper;

    /**
     * 保存请假人
     *
     * @param leave
     * @return
     */
    @Override
    public int save(Leave leave) {
        return leaveMapper.save(leave);
    }

    /**
     * 查看个人的历史请假记录
     *
     * @param user
     * @return
     */
    @Override
    public List<Leave> queryUser(String user) {
        return leaveMapper.queryUser(user);
    }

    /**
     * 修改请假
     *
     * @param leave
     * @return
     */
    @Override
    public int updateLeave(Leave leave) {
        return leaveMapper.updateLeave(leave);
    }

    /**
     * 销假
     *
     * @param user
     * @return
     */
    @Override
    public int updateStatus(String user) {
        return leaveMapper.updateStatus(user);
    }

    /**
     * 待审批的请假列表
     *
     * @return
     */
    @Override
    public List<Leave> queryStatus() {
        return leaveMapper.queryStatus();
    }

    /**
     * 批准
     *
     * @param user
     * @return
     */
    @Override
    public int approve(String user, Timestamp auditdate) {
        return leaveMapper.approve(user, auditdate);
    }

    /**
     * 拒绝
     *
     * @param user
     * @param auditdate
     * @param reject
     * @return
     */
    @Override
    public int rejected(String user, Timestamp auditdate, String reject) {
        return leaveMapper.rejected(user, auditdate, reject);
    }


    /**
     * 查看详情
     *
     * @param id
     * @return
     */
    @Override
    public Leave queryParticulars(int id) {
        return leaveMapper.queryParticulars(id);
    }
}
